cd ${work}5_reg_analysis

local ylist		"exp_status log_vrd_exp_exsmall"
local felist	`" "IDY FD FY" "'
local wlist		`" "" "'

use temp\regsample_idt, clear

xtset FD year

lab var treated_1 			"t"
lab var treated_lag 		"t-1"
lab var treated_lead		"t+1"
lab var tdcinitiative_1 	"t"
lab var tdcinitiative_lag 	"t-1"
lab var tdcinitiative_lead	"t+1"

eststo clear
local mtitles
local n=1

foreach y of local ylist {
local nfe=1	
foreach fe of local felist {
local w : word `nfe' of `wlist'

local m=1	
foreach x in treated tdcinitiative {	
	
	*"if statement" ensures we only include support/approach indicators affecting export sales in main regressions
	eststo est`m' : reghdfe `y' `x'_lead `x'_1 `x'_lag `w' if f.`y'!=. | f2.`y'!=., a(`fe') vce(cl F) noconst nosamp	
	local N = e(N)
	
	local ++m
	
}	
	
	eststo stacked_`n' : appendmodels est1 est2
	eststo drop est1 est2 est3
	qui estadd scalar N `N'
	qui estadd local FE `fe'
	if "`w'"!=""	qui estadd local SC "Yes"
	if "`w'"==""	qui estadd local SC "No"	
	local mtitles `mtitles' "`:var lab `y''"
		
	local ++n
	local ++nfe
		
}	
}
	
esttab stacked_* using output\table_4, booktabs replace se label ///
	title("Anticipation Effects") star(* 0.1 ** 0.05 *** 0.01) mtitles(`mtitles') keep(*_lead *_1 *_lag) ///
	stats(N FE SC , labels("Observations" "Fixed Effects" "Size Control") fmt(%10.0fc "" "")) ///
	refcat(treated_lead "Supported in" tdcinitiative_lead "Called in" , nolabel)	